<?php
	/**
	* 职位申请视图
	*/
	class ApplyViewModel extends ViewModel
	{
		public $table = 'apply';
		public $view = array(
				'people_resume1' =>array(
					'type' => INNER_JOIN,
					'on' => 'apply.resume1_reid = people_resume1.reid'
					),
				'company_baseinfo' =>array(
					'type'=>INNER_JOIN,
					'on'=>'apply.company_uid = company_baseinfo.cbid'
					),
				'positioncate' =>array(
					'type'=>INNER_JOIN,
					'on'=>'apply.position_cpid = positioncate.posid'
					)

			);

		public function get_data($field=null,$limit=null)
		{
			$checkstate = 2;
			switch (Q('get.checkstate')) {
				case '0':
					$checkstate = 0;
					break;
				case '1':
					$checkstate = 1;
					break;
				default:
					$_GET['checkstate']=2;
					break;
			}
			$where = array(
					'checkstate'=>$checkstate
				);
			if($checkstate == 2) unset($where['checkstate']);
			$data = $this->field($field)->join(array('people_resume1','company_baseinfo','positioncate'))->where($where)->limit($limit)->all();
			return $data;
		}
	}


?>